package org.feidao.chapter61.controller;

import com.alibaba.fastjson.JSON;
import org.feidao.chapter61.service.MqttService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by linghufeixia on 2021-1-10.
 */
@RestController
@RequestMapping(value = "/mqtt")
public class MqttController {
    @Autowired
    MqttService mqttService;

    /**
     */
    @RequestMapping(value = "/publish", method = RequestMethod.GET)
    public void publish(@RequestParam(value = "topic") String topic,
                      @RequestParam(value = "message") String message) {
        mqttService.sendMqttMessage(topic, message);
    }
}
